﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FlexminAPI;
using System.ServiceProcess;
using System.Diagnostics;

namespace ServiceBrowser
{
	public class ServiceSlave : ISlave 
	{
		public ServiceController[] GetServices()
		{			
			return ServiceController.GetServices();			
		}	

		public void ServiceStart(ServiceController service)
		{
			service.Start();
		}

		public void ServiceStop(ServiceController service)
		{
			service.Stop();
		}

		public void ServiceRestart(ServiceController service)
		{
			service.Stop();
			service.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromMilliseconds(3000));
			service.Start();
		}
	}
}
